package com.fqxiny.lease.common.minio;

import io.minio.BucketExistsArgs;
import io.minio.MinioClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author : 戚欣扬
 * @code :
 */
@Configuration
@EnableConfigurationProperties(value = MinioProperties.class)
public class MinioConfiguration {
    @Autowired
    MinioProperties properties;
    @Bean
    public MinioClient getClient(){
        return MinioClient
                .builder()
                .endpoint(properties.getEndpoint())
                .credentials(properties.getAccessKey(), properties.getSecretKey())
                .build();
    }
}


